package com.itheima.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.entity.Dish;
import com.itheima.jsonresult.JsonResult;
import com.itheima.service.DishFlavorsService;
import com.itheima.service.DishService;
import com.itheima.service.SetmealDishesService;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author linying
 * @since 2022-10-13
 */
@RestController
@RequestMapping("/setmeal")
public class SetmealController {

    @Autowired
    private SetmealService setmealService;

    @Autowired
    private DishService dishService;


    /**
     * 套餐列表
     * @param categoryId
     * @param status
     * @return
     */
    @GetMapping("/list")
    public JsonResult setmealList(String categoryId, String status) {
        return setmealService.setmealList(categoryId,status);
    }

    /**
     * 菜品详情
     * @param id
     * @return
     */
    @GetMapping("/dish/{id}")
    public JsonResult getDishById(@PathVariable String id) {
        return dishService.getDishById(id);
    }

}
